package org.example.springboot.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.example.springboot.common.entity.BaseEntity;

import java.util.Date;

/**
 * 用户表
 *
 * @author Fz
 * @since 1.0.0 2024-02-26
 */
@EqualsAndHashCode(callSuper = false)
@Data
@TableName("sys_user")
public class User{
    @IsKey
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField(exist = false)
    private String userId;

    /**
     * 联系手机
     */
    @Column(name = "mobile", comment = "联系手机", length = 100)
    private String mobile;

    /**
     * 是否为超级管理员 0 否 1 是
     */
    @Column(name = "super_admin", comment = "是否为超级管理员", type = MySqlTypeConstant.TINYINT, defaultValue = "0", length = 10)
    private Integer superAdmin;

    /**
     * 姓名
     */
    @Column(name = "real_name", comment = "姓名", length = 50)
    private String realName;

    /**
     * 密码盐
     */
    @JsonIgnore
    @Column(name = "head_url", comment = "头像", length = 200)
    private String headUrl;

    /**
     * 登录用户名
     */
    @Column(name = "username", comment = "登录用户名", length = 50)
    private String username;

    /**
     * 密码
     */
    @Column(name = "password", comment = "密码", length = 200)
    private String password;

    /**
     * 性别
     */
    @Column(name = "gender", comment = "性别", length = 2, type = MySqlTypeConstant.TINYINT)
    private Integer gender;

    /**
     * 邮箱
     */
    @Column(name = "email", comment = "邮箱", length = 100)
    private String email;

    /**
     * 部门
     */
    @Column(name = "dept_id", comment = "部门")
    private Long deptId;

    /**
     * 是否租户管理员 0 否 1 是
     */
    @Column(name = "super_tenant", comment = "是否租户管理员 0 否 1 是", length = 2, type = MySqlTypeConstant.TINYINT)
    private Integer superTenant;

    /**
     * 状态  0：停用   1：正常
     */
    @Column(name = "status", comment = "状态  0：停用   1：正常", length = 2, type = MySqlTypeConstant.TINYINT)
    private Integer status;

    /**
     * 租户编码
     */
    @Column(name = "tenant_code", comment = "租户编码")
    private Long tenantCode;

    /**
     * 创建者
     */
    @Column(name = "creator", comment = "创建者")
    private Long creator;

    /**
     * 更新人
     */
    @Column(name = "updater", comment = "更新人")
    private Long updater;

    /**
     * 删除标志 0 正常 1 已删除
     */
    @Column(name = "del_flag", comment = "删除标志 0 正常 1 已删除", length = 2, type = MySqlTypeConstant.TINYINT)
    private Integer delFlag;

    /**
     * 删除者
     */
    @Column(name = "deleter", comment = "删除者")
    private Long deleter;

    /**
     * 删除时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @Column(name = "delete_date", type = MySqlTypeConstant.DATETIME, comment = "删除时间")
    private Date deleteDate;

    /**
     * 是否会员  0：员工  1：会员
     */
    @Column(name = "ismember", comment = "是否会员  0：员工  1：会员", length = 2, type = MySqlTypeConstant.TINYINT)
    private Integer ismember;

    /**
     * 入职日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
    @Column(name = "entry_date", type = MySqlTypeConstant.DATE, comment = "入职日期")
    private Date entryDate;

    /**
     * 职务  0：员工  1：部门负责人
     */
    @Column(name = "duties", comment = "职务  0：员工  1：部门负责人", length = 2, type = MySqlTypeConstant.TINYINT)
    private Integer duties;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Column(name = "create_date", comment = "创建时间", type = MySqlTypeConstant.DATETIME, length = 100)
    private Date createDate;
    /**
     * 最后更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Column(name = "update_date", comment = "更新时间", type = MySqlTypeConstant.DATETIME, length = 36)
    private Date updateDate;

}